﻿using System.Windows;
using System.Windows.Controls;
using Pomodoro.ViewModels;

namespace Pomodoro.Oob
{
    public partial class MainPage : UserControl
    {
        private AppViewModel appViewModel;

        public MainPage()
        {
            InitializeComponent();

            this.appViewModel = new AppViewModel();
            this.appViewModel.Startup();


            this.Loaded += MainPage_Loaded;
            this.Unloaded += MainPage_Unloaded;
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = appViewModel;

        }

        void MainPage_Unloaded(object sender, RoutedEventArgs e)
        {
            this.appViewModel.Exit();
        }

    }
}
